home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
DELPHI32
/
SYS_TOOL
/
MULTI020
/
MPFOSSIL.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-09-07
|
4KB
|
170 lines
unit MPFossil;
{ Provide clients which connect pipes to fossils }
interface
uses asms, multi, mpipes
{$IFDEF DEBUG}
, nconv
{$ENDIF};
procedure AttachFossilInTask(com : byte; m : pPipe);
{ Start client which feeds data from the FOSSIL into the pipe. }
procedure AttachFossilOutTask(com : byte; m : pPipe);
{ Start client which feeds data from the pipe to the FOSSIL. }
implementation
const commparams : array[0..15] of byte =
(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
procedure FossilInTask(var m); far;
var
com : byte absolute m;
p : pPipe;
w : word;
label endoftask;
begin
p := pointer(meml[seg(m):ofs(m)+1]);
p^.NewInputTask;
if com > 15 then goto endoftask;
if commparams[com] and 1 = 1 then goto endoftask;
if commparams[com] and 2 = 0 then begin
asm
mov ah,4
les bx,[m]
mov dl,byte ptr es:[bx]
mov dh,0
mov bx,dx
push bx
int 14h
pop bx
cmp ax,$1954
jne @false
or byte ptr [bx+offset commparams],1
@false:
end;
if commparams[com] and 1 = 0 then goto endoftask;
end;
t^.hasexit := true;
repeat
repeat
asm
mov ax,$0C00
les di,[m]
mov dh,0
mov dl,byte ptr es:[di]
int $14
mov [w],ax
end;
if w <> $FFFF then begin
asm
mov ax,$0200
les di,[m]
mov dh,0
mov dl,byte ptr es:[di]
int $14
mov byte ptr [w],al
end;
p^.put(char(lo(w)));
end else break;
until false;
if Switch then break;
until false;
if commparams[com] and 2 = 0 then
asm
mov ah,5
mov dh,0
les bx,[m]
mov dl,byte ptr es:[bx]
mov dh,0
int $14
end;
maskbyte(commparams[com],1);
endoftask:
p^.NoMoreInput;
freemem(@m,5)
end;
procedure FossilOutTask(var m); far;
var
com : byte absolute m;
p : pPipe;
ch : char;
label endoftask;
begin
p := pointer(meml[seg(m):ofs(m)+1]);
p^.NewOutputTask;
if com > 15 then goto endoftask;
if commparams[com] and 2 = 2 then goto endoftask;
if commparams[com] and 1 = 0 then begin
asm
mov ah,4
les bx,[m]
mov dl,byte ptr es:[bx]
mov dh,0
mov bx,dx
push bx
int 14h
pop bx
cmp ax,$1954
jne @false
or byte ptr es:[bx+offset commparams],2
@false:
end;
if commparams[com] and 2 = 0 then goto endoftask;
end;
t^.hasexit := true;
repeat
repeat
if p^.peek(ch) then begin
asm
mov ah,$0B
mov al,[&ch]
les di,[m]
mov dh,0
mov dl,byte ptr es:[di]
int $14
mov [&ch],al
end;
if ch = #1 then
ch := p^.Get
else break
end else break;
until false;
if Switch then break;
until false;
if commparams[com] and 1 = 0 then
asm
mov ah,5
mov dh,0
les bx,[m]
mov dl,byte ptr es:[bx]
mov dh,0
int $14
end;
maskbyte(commparams[com],2);
endoftask:
p^.NoMoreOutput;
freemem(@m,5)
end;
procedure AttachFossilInTask(com : byte; m : pPipe);
var p,p1 : ^byte;
begin
getmem(p,5); p1 := p; p^ := com;
inc(p); move(m,p^,4);
Fork(FossilInTask,2048,p1^
{$IFDEF DEBUG} ,'FossilIn $'+byte2fhex(com) {$ENDIF});
end;
procedure AttachFossilOutTask(com : byte; m : pPipe);
var p,p1 : ^byte;
begin
getmem(p,5); p1 := p; p^ := com;
inc(p); move(m,p^,4);
Fork(FossilOutTask,2048,p1^
{$IFDEF DEBUG} ,'FossilOut $'+byte2fhex(com) {$ENDIF});
end;
end.